package com.guitar.accounting.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.guitar.accounting.mapper.UserMapper;
import com.guitar.accounting.model.User;

@Service
public class UserService {

    @Autowired
    UserMapper userMapper;
    
    @Transactional(propagation=Propagation.REQUIRED)
    public void addUser(User user){
        userMapper.insertUser(user);
    }
    
    @Transactional(propagation=Propagation.REQUIRED,readOnly=true)
    public User getUser(String account){
        return userMapper.getUserByAccount(account);
    }
}
